<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/page/base.jsp"%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
	    <base href="<%=basePath%>"></base>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title></title>
		<!-- Libraries -->
		<link type="text/css" href="<%=path %>/manage/css/layout.css" rel="stylesheet" />
		<link type="text/css" href="<%=path%>/manage/css/new_style.css" rel="stylesheet" />
		<script type="text/javascript" src="<%=path %>/manage/js/jquery-1.4.4.min.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/easyTooltip.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/jquery-ui-1.8.11.custom.min.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/jquery.wysiwyg.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/hoverIntent.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/superfish.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/custom.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/My97DatePicker/WdatePicker.js"></script>
		<sx:head />
		<script language="javascript" type="text/javascript">
		
function openFavorites(mesId) {
	    //应用编辑
			$.ajax({
				url : root+'/favorites/getFavorites.action',
				method : 'post',
				dataType : 'json',
				data:{'favoritesId' : mesId},
				success : function(data) {
				      $("#varUserName").attr("value",data.varUserName);
				      $("#varContentName").attr("value",data.varContentName);
				      $("#datFavoriteDatetime").attr("value",data.datFavoriteDatetime);
				      $("#varTypeName").attr("value",data.varTypeName);
					  $("#openFavoritesDialog").dialog("open");
				},
				error:function(err){
					if(err.responseText!='')
						alert(err.responseText);
					else
						alert("请求失败！");
				}
			});
			
		
	}
	
	
	
$(document).ready(function() {

		//加载消息编辑dialog
		$("#openFavoritesDialog").dialog({
			autoOpen : false,
			width : 420,
			height :350,
			modal : true,
			title : '收藏详情',
			buttons : {
				"关闭" : function() {
					$(this).dialog("close");
			}
			},
			close : function() {
				$("#openFavoritesform")[0].reset();
			}
        
	});
	});

//删除收藏
	function delFavorites(favoritesId) {
	if (confirm("慎重考虑是否确定删除该记录?删除后无法查看该条记录！！！")) {	  	  
			$.ajax({
				url : root+'/favorites/delFavorites.action',
				method : 'post',				
				data:{'favoritesId' : favoritesId},
				success : function(data) {
				  alert("删除成功");
				  window.location.href=root+'/favorites/getFavoritesPage.action';
				},
				error:function(err){
					if(err.responseText!='')
						alert(err.responseText);
					else
						alert("请求失败！");
				}
			});
			}
}
	
	
</script>

	</head>

	<body>
		
		<div>				<p class="sitemap">当前位置：内容管理 > 收藏管理</p>
                <h1>收藏管理</h1>
					<div >
					
						<!-- Tabs -->
						<div id="tabs">
							<ul>
								<li><a href="#tabs-1">收藏内容列表</a></li>
								
							</ul>
										<!-- 检索 -->
	  <div>
	<form name="searchForm" id="searchForm" method="post" action="<%=path %>/favorites/getFavoritesPage.action" style="margin:10px 0;">
	 内容标题:<s:textfield name="condition.varContentName"></s:textfield> 
	类型： <s:select name="condition.intType" list="typeTabMap" listKey="key"  listValue="value" 
		         							headerKey="" headerValue="—请选择—" />
		       	<input type="submit" id="searchBtn" value="检索" >    							
	</form> 
		         							
		</div>
	  	<!-- 检索 END-->
							<!-- First tab -->
					              <table cellspacing="0" cellpadding="0" border="0" class="fullwidth">
                                              <thead>
                                                <tr>
                                                  <td width="150px;">用户名</td>
                                                  <td>内容标题</td>
                                                  <td>收藏时间</td>
                                                  <td>类型</td>
                                                  <td>操作</td>
                                                </tr>
                                              </thead>
                                              <tbody>
                                              <s:iterator value="favoritesList">
                                                <tr class="odd">
                                                  <td><s:property value="varUserName"/></td>
                                                  <td><s:property value="varContentName"/></td>
                                                  <td><s:property value="datFavoriteDatetime"/></td>
                                                  <td><s:property value="varTypeName"/></td>
                                                  <td>
                                                 
                                                  <a class="icon icon_detail" title="详情 "  href="javascript:openFavorites('<s:property value="intFavoriteId" />')"> </a>
												<a class="icon icon_delete" title="删除 "  href="javascript:delFavorites('<s:property value="intFavoriteId" />')"></a>
								</td>
                                                </tr>
                                               </s:iterator> 
                                               
                                              </tbody>
                                          </table>
							<!-- End of Tabs -->
						</div>
							<!-- 分页标签开始 -->
                <div align="right" style="float:right;">
                <d:page id="page" template="details" skin="gray">
                </d:page>
                </div>
                <!-- 分页标签结束 -->
						<hr />
					</div>
				</div>
				
				
			
		<!-- 编辑页使用的弹出层 -->
		<div id="openFavoritesDialog" style="display: none;">
		<form id="openFavoritesform">
							<table class="fullwidth" cellpadding="0" cellspacing="0"
								border="0">
								<tr>
									<td>
										用户名
									</td>
									<td>									   
										<input type="text" name="favoritesInfo.varUserName" id="varUserName">
									</td>
								</tr>
								
								<tr>
									<td>
										内容标题
									</td>
									<td>									   
										<input type="text" name="favoritesInfo.varContentName" id="varContentName">
									</td>
								</tr>
								<tr>
									<td>
										类型
									</td>
									<td>									   
										<input type="text" name="favoritesInfo.varTypeName" id="varTypeName">
									</td>
								</tr>
								<tr>
									<td>
										收藏时间
									</td>
									<td>									   
										<input type="text" name="favoritesInfo.datFavoriteDatetime" id="datFavoriteDatetime" onClick="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})">
									</td>
								</tr>
							</table>
                       </form>
					</div>
	
	</body>
</html>
